#ifndef __STREAMS
#define __STREAMS

#ifdef __cplusplus
extern "C" {
#endif

#include<stdio.h>
#include<string.h>


#define SYSCALL 1
#define STDIO 2
#define MMAP 3

#define TRUE 1
#define FALSE 0

struct rstream_s
{
	char *file;         /* file path */
	int stream_type;
	int fd;             /* read */
	FILE *fp;           /* fread */
	int *map;           /* mmap */
	int eof;
	int eof_index;
	int buf_size;
	int *buf;
    int offset;         /*buf+offset = next read*/
};

typedef struct rstream_s rstream;

struct wstream_s
{
	char *file;         /* file path */
	int stream_type;
	int fd;             /* read */
	FILE *fp;           /* fread */
	int *map;           /* mmap */

	int buf_size;
	int *buf;
    int offset;        
};

typedef struct wstream_s wstream;


int wstream_create(wstream **wstream_ptr_addr , const char *path, int type, int size);

int rstream_open(rstream **rstream_ptr_addr, const char *path, int type, int size);

int copy_to_rstream_from_file(rstream *ptr);

int fcopy_to_rstream_from_file(rstream *ptr);

int rstream_read_next(rstream *ptr);

int end_of_rstream(rstream *ptr);

int wstream_write(wstream *ptr, int num);

int wstream_close(wstream *ptr);

#ifdef __cplusplus
}
#endif

#endif
